package com.gyg.controller;


import com.gyg.returns.RespEntity;
import com.gyg.service.CloudMessageService;
import com.gyg.vo.result.MessageListResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * <p>
 * 云盘消息表 前端控制器
 * </p>
 *
 * @author gyg
 * @since 2021-04-14
 */
@RestController
@RequestMapping("/cloud-message")
@Api(value = "云盘消息", tags = "云盘消息")
public class CloudMessageController {

    @Resource
    private CloudMessageService cloudMessageService;

    @ApiOperation(value = "消息列表")
    @GetMapping("/list")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", dataType = "Integer", name = "pageNum", value = "当前页数", required = true),
            @ApiImplicitParam(paramType = "query", dataType = "Integer", name = "pageSize", value = "每页数量", required = true)
    })
    public RespEntity<MessageListResult> cloudMessageList(@RequestParam(value = "pageNum", required = true) Integer pageNum,
                                                          @RequestParam(value = "pageSize", required = true) Integer pageSize) {
        RespEntity<MessageListResult> respEntity = cloudMessageService.cloudMessageList(pageNum, pageSize);
        return respEntity;
    }

    @GetMapping("/count")
    @ApiOperation(value = "消息数量")
    public RespEntity<Integer> cloudMessageCount() {
        RespEntity<Integer> respEntity = cloudMessageService.cloudMessageCount();
        return respEntity;
    }

}
